package com.dapeis.api.controller;

import com.ag.web.controller.BaseController;
import com.dapeis.api.spring.interceptor.StylistCollocationAuthApiInterceptor;
import com.dapeis.api.spring.interceptor.StylistUserAuthApiInterceptor;
import com.dapeis.domain.Collocation;
import com.dapeis.domain.User;

public class RestController extends BaseController {
	public static User getThreadLocalUser() {
		return StylistUserAuthApiInterceptor.userThreadLocal.get();
	}
	
	public static Collocation getThreadLocalCollocation() {
		return StylistCollocationAuthApiInterceptor.collocationThreadLocal.get();
	}
	
	public static Integer getThreadLocalUserId() {
		User user = getThreadLocalUser();
		if(user == null)
			return null;
		return user.getId();
	}
	
	public static Integer getThreadLocalCollocationId() {
		Collocation collocation = getThreadLocalCollocation();
		if(collocation == null)
			return null;
		return collocation.getId();
	}
}